import java.util.ArrayList;
import java.util.Iterator;


public class Menu {
	
	private static ArrayList<MenuItem> menu = new ArrayList<MenuItem>();
	
	public Menu() {
		menu.add(new MenuItem("Baked Rigatoni",2,false,10));
		menu.add(new MenuItem("Fettuccine Alfredo",2,false,11));
		menu.add(new MenuItem("Chocolate Cake",3,false,8));
		menu.add(new MenuItem("Cannoli",3,false,6));
		menu.add(new MenuItem("Caesar Salad",2,true,9));
		menu.add(new MenuItem("Chicken Salad",2,true,7));
		menu.add(new MenuItem("Mozzarella Sticks",1,false,5));
		menu.add(new MenuItem("Garlic Bread",1,false,2));
	}                      
	
	public static void add (MenuItem newItem) {
		menu.add(newItem);
	}

	public static void delete(int i) {
		menu.remove(i);
	}
	
	public Iterator getMenuIterator() {
		return new MenuIterator();
	}
	
	public Iterator getMenuItemIterator() {
		return new MenuItemIterator(); 
	}
	
	public Iterator getHeartHealthyIterator() {
		return new HeartHealthyIterator(); 
	} 
	
	public Iterator getPriceIterator() {
		return new PriceIterator(); 
	}

	private class MenuIterator implements Iterator<MenuItem> {
		
		private int counter = 0;
		
		@Override
		public boolean hasNext() {
			if(counter < menu.size())
				return true;
			return false;
		}

		@Override
		public MenuItem next() {
			counter++;
			return menu.get(counter-1);
		}

		@Override
		public void remove() {}
	}
	
	private class MenuItemIterator implements Iterator<MenuItem> {

		private int counter = 0;

		@Override
		public boolean hasNext() {
			if(counter < menu.size())
				return true;
			return false;
		}

		@Override
		public MenuItem next() {
			counter++;
			return menu.get(counter-1);
		}

		@Override
		public void remove() {}
	}
	
	private class HeartHealthyIterator implements Iterator<MenuItem> {

		private int counter = 0;
		
		@Override
		public boolean hasNext() {
			if(counter < menu.size())
				return true;
			return false;
		}

		@Override
		public MenuItem next() {
			counter++;
			return menu.get(counter-1);
		}

		@Override
		public void remove() {}
	}
	
	private class PriceIterator implements Iterator<MenuItem> {

		private int counter = 0;

		@Override
		public boolean hasNext() {
			if(counter < menu.size())
				return true;
			return false;
		}

		@Override
		public MenuItem next() {
			counter++;
			return menu.get(counter-1);
		}

		@Override
		public void remove() {}
	}
}
